/****************************************************************
 * Fulguro
 * Copyright (C) 2004 Christophe Clienti
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 ***************************************************************/

#ifdef __cplusplus
extern "C" {
#endif

#ifndef __FLGR_CORE_ARITH_DEF_H
#define __FLGR_CORE_ARITH_DEF_H
  
#include <flgrCoreDll.h>
#include <flgrCoreData.h>
#include <math.h>
#include <stdlib.h>

static __inline__ fgBIT flgr_defop_inf_fgBIT(fgBIT a,fgBIT b) {
  return (a&b);
}
static __inline__ fgUINT8 flgr_defop_inf_fgUINT8(fgUINT8 a,fgUINT8 b) {
  return (a<b?a:b);
}
static __inline__ fgUINT16 flgr_defop_inf_fgUINT16(fgUINT16 a,fgUINT16 b) {
  return (a<b?a:b);
}
static __inline__ fgUINT32 flgr_defop_inf_fgUINT32(fgUINT32 a,fgUINT32 b) {
  return (a<b?a:b);
}
static __inline__ fgUINT64 flgr_defop_inf_fgUINT64(fgUINT64 a,fgUINT64 b) {
  return (a<b?a:b);
}
static __inline__ fgINT8 flgr_defop_inf_fgINT8(fgINT8 a,fgINT8 b) {
  return (a<b?a:b);
}
static __inline__ fgINT16 flgr_defop_inf_fgINT16(fgINT16 a,fgINT16 b) {
  return (a<b?a:b);
}
static __inline__ fgINT32 flgr_defop_inf_fgINT32(fgINT32 a,fgINT32 b) {
  return (a<b?a:b);
}
static __inline__ fgINT64 flgr_defop_inf_fgINT64(fgINT64 a,fgINT64 b) {
  return (a<b?a:b);
}
static __inline__ fgFLOAT32 flgr_defop_inf_fgFLOAT32(fgFLOAT32 a,fgFLOAT32 b) {
  return (a<b?a:b);
}
static __inline__ fgFLOAT64 flgr_defop_inf_fgFLOAT64(fgFLOAT64 a,fgFLOAT64 b) {
  return (a<b?a:b);
}

static __inline__ fgBIT flgr_defop_sup_fgBIT(fgBIT a,fgBIT b) {
  return (a|b);
}
static __inline__ fgUINT8 flgr_defop_sup_fgUINT8(fgUINT8 a,fgUINT8 b) {
  return (a<b?b:a);
}
static __inline__ fgUINT16 flgr_defop_sup_fgUINT16(fgUINT16 a,fgUINT16 b) {
  return (a<b?b:a);
}
static __inline__ fgUINT32 flgr_defop_sup_fgUINT32(fgUINT32 a,fgUINT32 b) {
  return (a<b?b:a);
}
static __inline__ fgUINT64 flgr_defop_sup_fgUINT64(fgUINT64 a,fgUINT64 b) {
  return (a<b?b:a);
}
static __inline__ fgINT8 flgr_defop_sup_fgINT8(fgINT8 a,fgINT8 b) {
  return (a<b?b:a);
}
static __inline__ fgINT16 flgr_defop_sup_fgINT16(fgINT16 a,fgINT16 b) {
  return (a<b?b:a);
}
static __inline__ fgINT32 flgr_defop_sup_fgINT32(fgINT32 a,fgINT32 b) {
  return (a<b?b:a);
}
static __inline__ fgINT64 flgr_defop_sup_fgINT64(fgINT64 a,fgINT64 b) {
  return (a<b?b:a);
}
static __inline__ fgFLOAT32 flgr_defop_sup_fgFLOAT32(fgFLOAT32 a,fgFLOAT32 b) {
  return (a<b?b:a);
}
static __inline__ fgFLOAT64 flgr_defop_sup_fgFLOAT64(fgFLOAT64 a,fgFLOAT64 b) {
  return (a<b?b:a);
}

static __inline__ fgBIT flgr_defop_not_fgBIT(fgBIT a) {
  return ~a;
}
static __inline__ fgUINT8 flgr_defop_not_fgUINT8(fgUINT8 a) {
  return ~a;
}
static __inline__ fgUINT16 flgr_defop_not_fgUINT16(fgUINT16 a) {
  return ~a;
}
static __inline__ fgUINT32 flgr_defop_not_fgUINT32(fgUINT32 a) {
  return ~a;
}
static __inline__ fgUINT64 flgr_defop_not_fgUINT64(fgUINT64 a) {
  return ~a;
}
static __inline__ fgINT8 flgr_defop_not_fgINT8(fgINT8 a) {
  return ~a;
}
static __inline__ fgINT16 flgr_defop_not_fgINT16(fgINT16 a) {
  return ~a;
}
static __inline__ fgINT32 flgr_defop_not_fgINT32(fgINT32 a) {
  return ~a;
}
static __inline__ fgINT64 flgr_defop_not_fgINT64(fgINT64 a) {
  return ~a;
}

static __inline__ fgBIT flgr_defop_nand_fgBIT(fgBIT a,fgBIT b) {
  return ~(a&b);
}
static __inline__ fgUINT8 flgr_defop_nand_fgUINT8(fgUINT8 a,fgUINT8 b) {
  return ~(a&b);
}
static __inline__ fgUINT16 flgr_defop_nand_fgUINT16(fgUINT16 a,fgUINT16 b) {
  return ~(a&b);
}
static __inline__ fgUINT32 flgr_defop_nand_fgUINT32(fgUINT32 a,fgUINT32 b) {
  return ~(a&b);
}
static __inline__ fgUINT64 flgr_defop_nand_fgUINT64(fgUINT64 a,fgUINT64 b) {
  return ~(a&b);
}
static __inline__ fgINT8 flgr_defop_nand_fgINT8(fgINT8 a,fgINT8 b) {
  return ~(a&b);
}
static __inline__ fgINT16 flgr_defop_nand_fgINT16(fgINT16 a,fgINT16 b) {
  return ~(a&b);
}
static __inline__ fgINT32 flgr_defop_nand_fgINT32(fgINT32 a,fgINT32 b) {
  return ~(a&b);
}
static __inline__ fgINT64 flgr_defop_nand_fgINT64(fgINT64 a,fgINT64 b) {
  return ~(a&b);
}

static __inline__ fgBIT flgr_defop_and_fgBIT(fgBIT a,fgBIT b) {
  return (a & b);
}
static __inline__ fgUINT8 flgr_defop_and_fgUINT8(fgUINT8 a,fgUINT8 b) {
  return a&b;
}
static __inline__ fgUINT16 flgr_defop_and_fgUINT16(fgUINT16 a,fgUINT16 b) {
  return a&b;
}
static __inline__ fgUINT32 flgr_defop_and_fgUINT32(fgUINT32 a,fgUINT32 b) {
  return a&b;
}
static __inline__ fgUINT64 flgr_defop_and_fgUINT64(fgUINT64 a,fgUINT64 b) {
  return a&b;
}
static __inline__ fgINT8 flgr_defop_and_fgINT8(fgINT8 a,fgINT8 b) {
  return a&b;
}
static __inline__ fgINT16 flgr_defop_and_fgINT16(fgINT16 a,fgINT16 b) {
  return a&b;
}
static __inline__ fgINT32 flgr_defop_and_fgINT32(fgINT32 a,fgINT32 b) {
  return a&b;
}
static __inline__ fgINT64 flgr_defop_and_fgINT64(fgINT64 a,fgINT64 b) {
  return a&b;
}

static __inline__ fgBIT flgr_defop_or_fgBIT(fgBIT a,fgBIT b) {
  return (a | b);
}
static __inline__ fgUINT8 flgr_defop_or_fgUINT8(fgUINT8 a,fgUINT8 b) {
  return a|b;
}
static __inline__ fgUINT16 flgr_defop_or_fgUINT16(fgUINT16 a,fgUINT16 b) {
  return a|b;
}
static __inline__ fgUINT32 flgr_defop_or_fgUINT32(fgUINT32 a,fgUINT32 b) {
  return a|b;
}
static __inline__ fgUINT64 flgr_defop_or_fgUINT64(fgUINT64 a,fgUINT64 b) {
  return a|b;
}
static __inline__ fgINT8 flgr_defop_or_fgINT8(fgINT8 a,fgINT8 b) {
  return a|b;
}
static __inline__ fgINT16 flgr_defop_or_fgINT16(fgINT16 a,fgINT16 b) {
  return a|b;
}
static __inline__ fgINT32 flgr_defop_or_fgINT32(fgINT32 a,fgINT32 b) {
  return a|b;
}
static __inline__ fgINT64 flgr_defop_or_fgINT64(fgINT64 a,fgINT64 b) {
  return a|b;
}

static __inline__ fgBIT flgr_defop_nor_fgBIT(fgBIT a,fgBIT b) {
  return ~(a|b);
}
static __inline__ fgUINT8 flgr_defop_nor_fgUINT8(fgUINT8 a,fgUINT8 b) {
  return ~(a|b);
}
static __inline__ fgUINT16 flgr_defop_nor_fgUINT16(fgUINT16 a,fgUINT16 b) {
  return ~(a|b);
}
static __inline__ fgUINT32 flgr_defop_nor_fgUINT32(fgUINT32 a,fgUINT32 b) {
  return ~(a|b);
}
static __inline__ fgUINT64 flgr_defop_nor_fgUINT64(fgUINT64 a,fgUINT64 b) {
  return ~(a|b);
}
static __inline__ fgINT8 flgr_defop_nor_fgINT8(fgINT8 a,fgINT8 b) {
  return ~(a|b);
}
static __inline__ fgINT16 flgr_defop_nor_fgINT16(fgINT16 a,fgINT16 b) {
  return ~(a|b);
}
static __inline__ fgINT32 flgr_defop_nor_fgINT32(fgINT32 a,fgINT32 b) {
  return ~(a|b);
}
static __inline__ fgINT64 flgr_defop_nor_fgINT64(fgINT64 a,fgINT64 b) {
  return ~(a|b);
}


static __inline__ fgBIT flgr_defop_xor_fgBIT(fgBIT a,fgBIT b) {
  return (a ^ b);
}
static __inline__ fgUINT8 flgr_defop_xor_fgUINT8(fgUINT8 a,fgUINT8 b) {
  return a^b;
}
static __inline__ fgUINT16 flgr_defop_xor_fgUINT16(fgUINT16 a,fgUINT16 b) {
  return a^b;
}
static __inline__ fgUINT32 flgr_defop_xor_fgUINT32(fgUINT32 a,fgUINT32 b) {
  return a^b;
}
static __inline__ fgUINT64 flgr_defop_xor_fgUINT64(fgUINT64 a,fgUINT64 b) {
  return a^b;
}
static __inline__ fgINT8 flgr_defop_xor_fgINT8(fgINT8 a,fgINT8 b) {
  return a^b;
}
static __inline__ fgINT16 flgr_defop_xor_fgINT16(fgINT16 a,fgINT16 b) {
  return a^b;
}
static __inline__ fgINT32 flgr_defop_xor_fgINT32(fgINT32 a,fgINT32 b) {
  return a^b;
}
static __inline__ fgINT64 flgr_defop_xor_fgINT64(fgINT64 a,fgINT64 b) {
  return a^b;
}


static __inline__ fgBIT flgr_defop_nxor_fgBIT(fgBIT a,fgBIT b) {
  return ~(a^b);
}
static __inline__ fgUINT8 flgr_defop_nxor_fgUINT8(fgUINT8 a,fgUINT8 b) {
  return ~(a^b);
}
static __inline__ fgUINT16 flgr_defop_nxor_fgUINT16(fgUINT16 a,fgUINT16 b) {
  return ~(a^b);
}
static __inline__ fgUINT32 flgr_defop_nxor_fgUINT32(fgUINT32 a,fgUINT32 b) {
  return ~(a^b);
}
static __inline__ fgUINT64 flgr_defop_nxor_fgUINT64(fgUINT64 a,fgUINT64 b) {
  return ~(a^b);
}
static __inline__ fgINT8 flgr_defop_nxor_fgINT8(fgINT8 a,fgINT8 b) {
  return ~(a^b);
}
static __inline__ fgINT16 flgr_defop_nxor_fgINT16(fgINT16 a,fgINT16 b) {
  return ~(a^b);
}
static __inline__ fgINT32 flgr_defop_nxor_fgINT32(fgINT32 a,fgINT32 b) {
  return ~(a^b);
}
static __inline__ fgINT64 flgr_defop_nxor_fgINT64(fgINT64 a,fgINT64 b) {
  return ~(a^b);
}


static __inline__ fgUINT8 flgr_defop_add_fgUINT8(fgUINT8 a,fgUINT8 b) {
  return a+b;
}
static __inline__ fgUINT16 flgr_defop_add_fgUINT16(fgUINT16 a,fgUINT16 b) {
  return a+b;
}
static __inline__ fgUINT32 flgr_defop_add_fgUINT32(fgUINT32 a,fgUINT32 b) {
  return a+b;
}
static __inline__ fgUINT64 flgr_defop_add_fgUINT64(fgUINT64 a,fgUINT64 b) {
  return a+b;
}
static __inline__ fgINT8 flgr_defop_add_fgINT8(fgINT8 a,fgINT8 b) {
  return a+b;
}
static __inline__ fgINT16 flgr_defop_add_fgINT16(fgINT16 a,fgINT16 b) {
  return a+b;
}
static __inline__ fgINT32 flgr_defop_add_fgINT32(fgINT32 a,fgINT32 b) {
  return a+b;
}
static __inline__ fgINT64 flgr_defop_add_fgINT64(fgINT64 a,fgINT64 b) {
  return a+b;
}
static __inline__ fgFLOAT32 flgr_defop_add_fgFLOAT32(fgFLOAT32 a,fgFLOAT32 b) {
  return a+b;
}
static __inline__ fgFLOAT64 flgr_defop_add_fgFLOAT64(fgFLOAT64 a,fgFLOAT64 b) {
  return a+b;
}

static __inline__ fgUINT8 flgr_defop_sub_a_b_fgUINT8(fgUINT8 a,fgUINT8 b) {
  return a-b;
}
static __inline__ fgUINT16 flgr_defop_sub_a_b_fgUINT16(fgUINT16 a,fgUINT16 b) {
  return a-b;
}
static __inline__ fgUINT32 flgr_defop_sub_a_b_fgUINT32(fgUINT32 a,fgUINT32 b) {
  return a-b;
}
static __inline__ fgUINT64 flgr_defop_sub_a_b_fgUINT64(fgUINT64 a,fgUINT64 b) {
  return a-b;
}
static __inline__ fgINT8 flgr_defop_sub_a_b_fgINT8(fgINT8 a,fgINT8 b) {
  return a-b;
}
static __inline__ fgINT16 flgr_defop_sub_a_b_fgINT16(fgINT16 a,fgINT16 b) {
  return a-b;
}
static __inline__ fgINT32 flgr_defop_sub_a_b_fgINT32(fgINT32 a,fgINT32 b) {
  return a-b;
}
static __inline__ fgINT64 flgr_defop_sub_a_b_fgINT64(fgINT64 a,fgINT64 b) {
  return a-b;
}
static __inline__ fgFLOAT32 flgr_defop_sub_a_b_fgFLOAT32(fgFLOAT32 a,fgFLOAT32 b) {
  return a-b;
}
static __inline__ fgFLOAT64 flgr_defop_sub_a_b_fgFLOAT64(fgFLOAT64 a,fgFLOAT64 b) {
  return a-b;
}

static __inline__ fgUINT8 flgr_defop_sub_b_a_fgUINT8(fgUINT8 a,fgUINT8 b) {
  return b-a;
}
static __inline__ fgUINT16 flgr_defop_sub_b_a_fgUINT16(fgUINT16 a,fgUINT16 b) {
  return b-a;
}
static __inline__ fgUINT32 flgr_defop_sub_b_a_fgUINT32(fgUINT32 a,fgUINT32 b) {
  return b-a;
}
static __inline__ fgUINT64 flgr_defop_sub_b_a_fgUINT64(fgUINT64 a,fgUINT64 b) {
  return b-a;
}
static __inline__ fgINT8 flgr_defop_sub_b_a_fgINT8(fgINT8 a,fgINT8 b) {
  return b-a;
}
static __inline__ fgINT16 flgr_defop_sub_b_a_fgINT16(fgINT16 a,fgINT16 b) {
  return b-a;
}
static __inline__ fgINT32 flgr_defop_sub_b_a_fgINT32(fgINT32 a,fgINT32 b) {
  return b-a;
}
static __inline__ fgINT64 flgr_defop_sub_b_a_fgINT64(fgINT64 a,fgINT64 b) {
  return b-a;
}
static __inline__ fgFLOAT32 flgr_defop_sub_b_a_fgFLOAT32(fgFLOAT32 a,fgFLOAT32 b) {
  return b-a;
}
static __inline__ fgFLOAT64 flgr_defop_sub_b_a_fgFLOAT64(fgFLOAT64 a,fgFLOAT64 b) {
  return b-a;
}

static __inline__ fgUINT8 flgr_defop_mult_fgUINT8(fgUINT8 a,fgUINT8 b) {
  return a*b;
}
static __inline__ fgUINT16 flgr_defop_mult_fgUINT16(fgUINT16 a,fgUINT16 b) {
  return a*b;
}
static __inline__ fgUINT32 flgr_defop_mult_fgUINT32(fgUINT32 a,fgUINT32 b) {
  return a*b;
}
static __inline__ fgUINT64 flgr_defop_mult_fgUINT64(fgUINT64 a,fgUINT64 b) {
  return a*b;
}
static __inline__ fgINT8 flgr_defop_mult_fgINT8(fgINT8 a,fgINT8 b) {
  return a*b;
}
static __inline__ fgINT16 flgr_defop_mult_fgINT16(fgINT16 a,fgINT16 b) {
  return a*b;
}
static __inline__ fgINT32 flgr_defop_mult_fgINT32(fgINT32 a,fgINT32 b) {
  return a*b;
}
static __inline__ fgINT64 flgr_defop_mult_fgINT64(fgINT64 a,fgINT64 b) {
  return a*b;
}
static __inline__ fgFLOAT32 flgr_defop_mult_fgFLOAT32(fgFLOAT32 a,fgFLOAT32 b) {
  return a*b;
}
static __inline__ fgFLOAT64 flgr_defop_mult_fgFLOAT64(fgFLOAT64 a,fgFLOAT64 b) {
  return a*b;
}

static __inline__ fgUINT8 flgr_defop_div_fgUINT8(fgUINT8 a,fgUINT8 b) {
  return a/b;
}
static __inline__ fgUINT16 flgr_defop_div_fgUINT16(fgUINT16 a,fgUINT16 b) {
  return a/b;
}
static __inline__ fgUINT32 flgr_defop_div_fgUINT32(fgUINT32 a,fgUINT32 b) {
  return a/b;
}
static __inline__ fgUINT64 flgr_defop_div_fgUINT64(fgUINT64 a,fgUINT64 b) {
  return a/b;
}
static __inline__ fgINT8 flgr_defop_div_fgINT8(fgINT8 a,fgINT8 b) {
  return a/b;
}
static __inline__ fgINT16 flgr_defop_div_fgINT16(fgINT16 a,fgINT16 b) {
  return a/b;
}
static __inline__ fgINT32 flgr_defop_div_fgINT32(fgINT32 a,fgINT32 b) {
  return a/b;
}
static __inline__ fgINT64 flgr_defop_div_fgINT64(fgINT64 a,fgINT64 b) {
  return a/b;
}
static __inline__ fgFLOAT32 flgr_defop_div_fgFLOAT32(fgFLOAT32 a,fgFLOAT32 b) {
  return a/b;
}
static __inline__ fgFLOAT64 flgr_defop_div_fgFLOAT64(fgFLOAT64 a,fgFLOAT64 b) {
  return a/b;
}

static __inline__ fgUINT8 flgr_defop_addsat_fgUINT8(fgUINT8 a,fgUINT8 b) {
  fgUINT32 x;
  x=((fgUINT32) a) + ((fgUINT32) b);
  if(x>MAX_fgUINT8) return MAX_fgUINT8;
  else return (fgUINT8) x;
}
static __inline__ fgUINT16 flgr_defop_addsat_fgUINT16(fgUINT16 a,fgUINT16 b) {
  fgUINT32 x;
  x=((fgUINT32) a) + ((fgUINT32) b);
  if(x>MAX_fgUINT16) return MAX_fgUINT16;
  else return (fgUINT16) x;
}
static __inline__ fgUINT32 flgr_defop_addsat_fgUINT32(fgUINT32 a,fgUINT32 b) {
  long long x;
  x=((long long) a) + ((long long) b);
  if(x>MAX_fgUINT32) return MAX_fgUINT32;
  else return (fgUINT32) x;
}
static __inline__ fgINT8 flgr_defop_addsat_fgINT8(fgINT8 a,fgINT8 b) {
  fgINT32 x;
  x=((fgINT32) a) + ((fgINT32) b);
  if(x>MAX_fgINT8) return MAX_fgINT8;
  else return (fgINT8) x;
}
static __inline__ fgINT16 flgr_defop_addsat_fgINT16(fgINT16 a,fgINT16 b) {
  fgINT32 x;
  x=((fgINT32) a) + ((fgINT32) b);
  if(x>MAX_fgINT16) return MAX_fgINT16;
  else return (fgINT16) x;
}
static __inline__ fgINT32 flgr_defop_addsat_fgINT32(fgINT32 a,fgINT32 b) {
  long long x;
  x=((long long) a) + ((long long) b);
  if(x>MAX_fgINT32) return MAX_fgINT32;
  else return (fgINT32) x;
}

static __inline__ fgUINT8 flgr_defop_subsat_fgUINT8(fgUINT8 a,fgUINT8 b) {
  fgINT32 x;
  x=((fgINT32) a) - ((fgINT32) b);
  if(x<0) return 0;
  else return (fgUINT8) x;
}
static __inline__ fgUINT16 flgr_defop_subsat_fgUINT16(fgUINT16 a,fgUINT16 b) {
  fgINT32 x;
  x=((fgINT32) a) - ((fgINT32) b);
  if(x<0) return 0;
  else return (fgUINT16) x;
}
static __inline__ fgUINT32 flgr_defop_subsat_fgUINT32(fgUINT32 a,fgUINT32 b) {
  long long x;
  x=((long long) a) - ((long long) b);
  if(x<0) return 0;
  else return (fgUINT32) x;
}
static __inline__ fgINT8 flgr_defop_subsat_fgINT8(fgINT8 a,fgINT8 b) {
  fgINT32 x;
  x=((fgINT32) a) - ((fgINT32) b);
  if(x<MIN_fgINT8) return MIN_fgINT8;
  else return (fgINT8) x;
}
static __inline__ fgINT16 flgr_defop_subsat_fgINT16(fgINT16 a,fgINT16 b) {
  fgINT32 x;
  x=((fgINT32) a) - ((fgINT32) b);
  if(x<MIN_fgINT16) return MIN_fgINT16;
  else return (fgINT16) x;
}
static __inline__ fgINT32 flgr_defop_subsat_fgINT32(fgINT32 a,fgINT32 b) {
  long long x;
  x=((long long) a) - ((long long) b);
  if(x<MIN_fgINT32) return MIN_fgINT32;
  else return (fgINT32) x;
}

static __inline__ fgUINT8 flgr_defop_multsat_fgUINT8(fgUINT8 a,fgUINT8 b) {
  fgINT32 x;
  x=((fgINT32) a) * ((fgINT32) b);
  if(x>MAX_fgUINT8) return MAX_fgUINT8;
  else return (fgUINT8) x;
}
static __inline__ fgUINT16 flgr_defop_multsat_fgUINT16(fgUINT16 a,fgUINT16 b) {
  fgINT32 x;
  x=((fgINT32) a) * ((fgINT32) b);
  if(x>MAX_fgUINT16) return MAX_fgUINT16;
  else return (fgUINT16) x;
}
static __inline__ fgUINT32 flgr_defop_multsat_fgUINT32(fgUINT32 a,fgUINT32 b) {
  long long x;
  x=((long long) a) * ((long long) b);
  if(x>MAX_fgUINT32) return MAX_fgUINT32;
  else return (fgUINT32) x;
}
static __inline__ fgINT8 flgr_defop_multsat_fgINT8(fgINT8 a,fgINT8 b) {
  fgINT32 x;
  x=((fgINT32) a) * ((fgINT32) b);
  if(x>MAX_fgINT8) return MAX_fgINT8;
  else return (fgINT8) x;
}
static __inline__ fgINT16 flgr_defop_multsat_fgINT16(fgINT16 a,fgINT16 b) {
  fgINT32 x;
  x=((fgINT32) a) * ((fgINT32) b);
  if(x>MAX_fgINT16) return MAX_fgINT16;
  else return (fgINT16) x;
}
static __inline__ fgINT32 flgr_defop_multsat_fgINT32(fgINT32 a,fgINT32 b) {
  long long x;
  x=((long long) a) * ((long long) b);
  if(x>MAX_fgINT32) return MAX_fgINT32;
  else return (fgINT32) x;
}

static __inline__ fgUINT8 flgr_defop_module_fgUINT8(fgUINT8 a,fgUINT8 b) {
  double tmp;
  tmp=pow(a,2)+pow(b,2);
  return (fgUINT8) (sqrt(tmp));
}
static __inline__ fgUINT16 flgr_defop_module_fgUINT16(fgUINT16 a,fgUINT16 b) {
  double tmp;
  tmp=pow(a,2)+pow(b,2);
  return (fgUINT16) (sqrt(tmp));
}
static __inline__ fgUINT32 flgr_defop_module_fgUINT32(fgUINT32 a,fgUINT32 b) {
  double tmp;
  tmp=pow(a,2)+pow(b,2);
  return (fgUINT32) (sqrt(tmp));
}
static __inline__ fgUINT64 flgr_defop_module_fgUINT64(fgUINT64 a,fgUINT64 b) {
  double tmp;
  tmp=pow(a,2)+pow(b,2);
  return (fgUINT64) (sqrt(tmp));
}
static __inline__ fgINT8 flgr_defop_module_fgINT8(fgINT8 a,fgINT8 b) {
  double tmp;
  tmp=pow(a,2)+pow(b,2);
  return (fgINT8) (sqrt(tmp));
}
static __inline__ fgINT16 flgr_defop_module_fgINT16(fgINT16 a,fgINT16 b) {
  double tmp;
  tmp=pow(a,2)+pow(b,2);
  return (fgINT16) (sqrt(tmp));
}
static __inline__ fgINT32 flgr_defop_module_fgINT32(fgINT32 a,fgINT32 b) {
  double tmp;
  tmp=pow(a,2)+pow(b,2);
  return (fgINT32) (sqrt(tmp));
}
static __inline__ fgINT64 flgr_defop_module_fgINT64(fgINT64 a,fgINT64 b) {
  double tmp;
  tmp=pow(a,2)+pow(b,2);
  return (fgINT64) (sqrt(tmp));
}
static __inline__ fgFLOAT32 flgr_defop_module_fgFLOAT32(fgFLOAT32 a,fgFLOAT32 b) {
  double tmp;
  tmp=pow(a,2)+pow(b,2);
  return (fgFLOAT32) (sqrt(tmp));
}
static __inline__ fgFLOAT64 flgr_defop_module_fgFLOAT64(fgFLOAT64 a,fgFLOAT64 b) {
  double tmp;
  tmp=pow(a,2)+pow(b,2);
  return (fgFLOAT64) (sqrt(tmp));
}

static __inline__ fgUINT8 flgr_defop_argument_fgUINT8(fgUINT8 a,fgUINT8 b) {
  double tmp;
  tmp=pow(a,2)+pow(b,2);
  tmp=sqrt(tmp);
  tmp=acos(a/tmp);
  return (fgUINT8) tmp;
}
static __inline__ fgUINT16 flgr_defop_argument_fgUINT16(fgUINT16 a,fgUINT16 b) {
  double tmp;
  tmp=pow(a,2)+pow(b,2);
  tmp=sqrt(tmp);
  tmp=acos(a/tmp);
  return (fgUINT16) tmp;
}
static __inline__ fgUINT32 flgr_defop_argument_fgUINT32(fgUINT32 a,fgUINT32 b) {
  double tmp;
  tmp=pow(a,2)+pow(b,2);
  tmp=sqrt(tmp);
  tmp=acos(a/tmp);
  return (fgUINT32) tmp;
}
static __inline__ fgUINT64 flgr_defop_argument_fgUINT64(fgUINT64 a,fgUINT64 b) {
  double tmp;
  tmp=pow(a,2)+pow(b,2);
  tmp=sqrt(tmp);
  tmp=acos(a/tmp);
  return (fgUINT64) tmp;
}
static __inline__ fgINT8 flgr_defop_argument_fgINT8(fgINT8 a,fgINT8 b) {
  double tmp;
  tmp=pow(a,2)+pow(b,2);
  tmp=sqrt(tmp);
  tmp=acos(a/tmp);
  return (fgINT8) tmp;
}
static __inline__ fgINT16 flgr_defop_argument_fgINT16(fgINT16 a,fgINT16 b) {
  double tmp;
  tmp=pow(a,2)+pow(b,2);
  tmp=sqrt(tmp);
  tmp=acos(a/tmp);
  return (fgINT16) tmp;
}
static __inline__ fgINT32 flgr_defop_argument_fgINT32(fgINT32 a,fgINT32 b) {
  double tmp;
  tmp=pow(a,2)+pow(b,2);
  tmp=sqrt(tmp);
  tmp=acos(a/tmp);
  return (fgINT32) tmp;
}
static __inline__ fgINT64 flgr_defop_argument_fgINT64(fgINT64 a,fgINT64 b) {
  double tmp;
  tmp=pow(a,2)+pow(b,2);
  tmp=sqrt(tmp);
  tmp=acos(a/tmp);
  return (fgINT64) tmp;
}
static __inline__ fgFLOAT32 flgr_defop_argument_fgFLOAT32(fgFLOAT32 a,fgFLOAT32 b) {
  double tmp;
  tmp=pow(a,2)+pow(b,2);
  tmp=sqrt(tmp);
  tmp=acos(a/tmp);
  return (fgFLOAT32) tmp;
}
static __inline__ fgFLOAT64 flgr_defop_argument_fgFLOAT64(fgFLOAT64 a,fgFLOAT64 b) {
  double tmp;
  tmp=pow(a,2)+pow(b,2);
  tmp=sqrt(tmp);
  tmp=acos(a/tmp);
  return (fgFLOAT64) tmp;
}

static __inline__ fgFLOAT32 flgr_defop_atan2_fgFLOAT32(fgFLOAT32 a,fgFLOAT32 b) {
  return atan2f(a,b);
}
static __inline__ fgFLOAT64 flgr_defop_atan2_fgFLOAT64(fgFLOAT64 a,fgFLOAT64 b) {
  return atan2(a,b);
}


static __inline__ fgBIT flgr_defop_invert_fgBIT(fgBIT a) {
  return ~a;
}
static __inline__ fgUINT8 flgr_defop_invert_fgUINT8(fgUINT8 a) {
  return MAX_fgUINT8-a;
}
static __inline__ fgUINT16 flgr_defop_invert_fgUINT16(fgUINT16 a) {
  return MAX_fgUINT16-a;
}
static __inline__ fgUINT32 flgr_defop_invert_fgUINT32(fgUINT32 a) {
  return MAX_fgUINT32-a;
}
static __inline__ fgUINT64 flgr_defop_invert_fgUINT64(fgUINT64 a) {
  return MAX_fgUINT64-a;
}
static __inline__ fgINT8 flgr_defop_invert_fgINT8(fgINT8 a) {
  return -a;
}
static __inline__ fgINT16 flgr_defop_invert_fgINT16(fgINT16 a) {
  return -a;
}
static __inline__ fgINT32 flgr_defop_invert_fgINT32(fgINT32 a) {
  return -a;
}
static __inline__ fgINT64 flgr_defop_invert_fgINT64(fgINT64 a) {
  return -a;
}
static __inline__ fgFLOAT32 flgr_defop_invert_fgFLOAT32(fgFLOAT32 a) {
  return -a;
}
static __inline__ fgFLOAT64 flgr_defop_invert_fgFLOAT64(fgFLOAT64 a) {
  return -a;
}


static __inline__ fgINT8 flgr_defop_abs_fgINT8(fgINT8 a) {
  return abs(a);
}

static __inline__ fgINT16 flgr_defop_abs_fgINT16(fgINT16 a) {
  return abs(a);
}

static __inline__ fgINT32 flgr_defop_abs_fgINT32(fgINT32 a) {
  return abs(a);
}

static __inline__ fgINT64 flgr_defop_abs_fgINT64(fgINT64 a) {
  return abs(a);
}

static __inline__ fgFLOAT32 flgr_defop_abs_fgFLOAT32(fgFLOAT32 a) {
  return fabsf(a);
}

static __inline__ fgFLOAT64 flgr_defop_abs_fgFLOAT64(fgFLOAT64 a) {
  return fabs(a);
}



static __inline__ fgUINT8 flgr_defop_logb_fgUINT8(fgUINT8 a, fgFLOAT64 b) {
  return ((fgUINT8) ( log( (fgFLOAT64) (a)) / log(b) ));
}
static __inline__ fgUINT16 flgr_defop_logb_fgUINT16(fgUINT16 a,  fgFLOAT64 b) {
  return ((fgUINT16) ( log( (fgFLOAT64) (a)) / log(b) ));
}
static __inline__ fgUINT32 flgr_defop_logb_fgUINT32(fgUINT32 a,  fgFLOAT64 b) {
  return ((fgUINT32) ( log( (fgFLOAT64) (a)) / log(b) ));
}
static __inline__ fgUINT64 flgr_defop_logb_fgUINT64(fgUINT64 a,  fgFLOAT64 b) {
  return ((fgUINT64) ( log( (fgFLOAT64) (a)) / log(b) ));
}
static __inline__ fgINT8 flgr_defop_logb_fgINT8(fgINT8 a,  fgFLOAT64 b) {
  return ((fgINT8) ( log( (fgFLOAT64) (a)) / log(b) ));
}
static __inline__ fgINT16 flgr_defop_logb_fgINT16(fgINT16 a,  fgFLOAT64 b) {
  return ((fgINT16) ( log( (fgFLOAT64) (a)) / log(b) ));
}
static __inline__ fgINT32 flgr_defop_logb_fgINT32(fgINT32 a,  fgFLOAT64 b) {
  return ((fgINT32) ( log( (fgFLOAT64) (a)) / log(b) ));
}
static __inline__ fgINT64 flgr_defop_logb_fgINT64(fgINT64 a,  fgFLOAT64 b) {
  return ((fgINT64) ( log( (fgFLOAT64) (a)) / log(b) ));
}
static __inline__ fgFLOAT32 flgr_defop_logb_fgFLOAT32(fgFLOAT32 a,  fgFLOAT64 b) {
  return ((fgFLOAT32) ( log( (fgFLOAT64) (a)) / log(b) ));
}
static __inline__ fgFLOAT64 flgr_defop_logb_fgFLOAT64(fgFLOAT64 a,  fgFLOAT64 b) {
  return ((fgFLOAT64) ( log( (fgFLOAT64) (a)) / log(b) ));
}


static __inline__ fgUINT8 flgr_defop_powb_fgUINT8(fgUINT8 a, fgFLOAT64 b) {
  return ((fgUINT8) ( pow( (fgFLOAT64) (a), b )));
}
static __inline__ fgUINT16 flgr_defop_powb_fgUINT16(fgUINT16 a,  fgFLOAT64 b) {
  return ((fgUINT16) ( pow( (fgFLOAT64) (a), b )));
}
static __inline__ fgUINT32 flgr_defop_powb_fgUINT32(fgUINT32 a,  fgFLOAT64 b) {
  return ((fgUINT32) ( pow( (fgFLOAT64) (a), b )));
}
static __inline__ fgUINT64 flgr_defop_powb_fgUINT64(fgUINT64 a,  fgFLOAT64 b) {
  return ((fgUINT64) ( pow( (fgFLOAT64) (a), b )));
}
static __inline__ fgINT8 flgr_defop_powb_fgINT8(fgINT8 a,  fgFLOAT64 b) {
  return ((fgINT8) ( pow( (fgFLOAT64) (a), b )));
}
static __inline__ fgINT16 flgr_defop_powb_fgINT16(fgINT16 a,  fgFLOAT64 b) {
  return ((fgINT16) ( pow( (fgFLOAT64) (a), b )));
}
static __inline__ fgINT32 flgr_defop_powb_fgINT32(fgINT32 a,  fgFLOAT64 b) {
  return ((fgINT32) ( pow( (fgFLOAT64) (a), b )));
}
static __inline__ fgINT64 flgr_defop_powb_fgINT64(fgINT64 a,  fgFLOAT64 b) {
  return ((fgINT64) ( pow( (fgFLOAT64) (a), b )));
}
static __inline__ fgFLOAT32 flgr_defop_powb_fgFLOAT32(fgFLOAT32 a,  fgFLOAT64 b) {
  return ((fgFLOAT32) ( pow( (fgFLOAT64) (a), b )));
}
static __inline__ fgFLOAT64 flgr_defop_powb_fgFLOAT64(fgFLOAT64 a,  fgFLOAT64 b) {
  return ((fgFLOAT64) ( pow( (fgFLOAT64) (a), b )));
}



static __inline__ fgUINT8 flgr_defop_square_fgUINT8(fgUINT8 a) {
  return a*a;
}
static __inline__ fgUINT16 flgr_defop_square_fgUINT16(fgUINT16 a) {
  return a*a;
}
static __inline__ fgUINT32 flgr_defop_square_fgUINT32(fgUINT32 a) {
  return a*a;
}
static __inline__ fgUINT64 flgr_defop_square_fgUINT64(fgUINT64 a) {
  return a*a;
}
static __inline__ fgINT8 flgr_defop_square_fgINT8(fgINT8 a) {
  return a*a;
}
static __inline__ fgINT16 flgr_defop_square_fgINT16(fgINT16 a) {
  return a*a;
}
static __inline__ fgINT32 flgr_defop_square_fgINT32(fgINT32 a) {
  return a*a; 
}
static __inline__ fgINT64 flgr_defop_square_fgINT64(fgINT64 a) {
  return a*a;
}
static __inline__ fgFLOAT32 flgr_defop_square_fgFLOAT32(fgFLOAT32 a) {
  return a*a; 
}
static __inline__ fgFLOAT64 flgr_defop_square_fgFLOAT64(fgFLOAT64 a) {
  return a*a;
}


static __inline__ fgUINT8 flgr_defop_sqrt_fgUINT8(fgUINT8 a) {
  return (fgUINT8) sqrt(a);
}
static __inline__ fgUINT16 flgr_defop_sqrt_fgUINT16(fgUINT16 a) {
  return (fgUINT16) sqrt(a); 
}
static __inline__ fgUINT32 flgr_defop_sqrt_fgUINT32(fgUINT32 a) {
  return (fgUINT32) sqrt(a); 
}
static __inline__ fgUINT64 flgr_defop_sqrt_fgUINT64(fgUINT64 a) {
  return (fgUINT64) sqrt(a); 
}
static __inline__ fgINT8 flgr_defop_sqrt_fgINT8(fgINT8 a) {
  return (fgINT8) sqrt(a); 
}
static __inline__ fgINT16 flgr_defop_sqrt_fgINT16(fgINT16 a) {
  return (fgINT16) sqrt(a); 
}
static __inline__ fgINT32 flgr_defop_sqrt_fgINT32(fgINT32 a) {
  return (fgINT32) sqrt(a); 
}
static __inline__ fgINT64 flgr_defop_sqrt_fgINT64(fgINT64 a) {
  return (fgINT64) sqrt(a); 
}
static __inline__ fgFLOAT32 flgr_defop_sqrt_fgFLOAT32(fgFLOAT32 a) {
  return sqrtf(a); 
}
static __inline__ fgFLOAT64 flgr_defop_sqrt_fgFLOAT64(fgFLOAT64 a) {
  return sqrt(a); 
}


static __inline__ fgFLOAT32 flgr_defop_cos_fgFLOAT32(fgFLOAT32 a) {
  return cosf(a);
}
static __inline__ fgFLOAT64 flgr_defop_cos_fgFLOAT64(fgFLOAT64 a) {
  return cos(a);
}

static __inline__ fgFLOAT32 flgr_defop_sin_fgFLOAT32(fgFLOAT32 a) {
  return sinf(a);
}
static __inline__ fgFLOAT64 flgr_defop_sin_fgFLOAT64(fgFLOAT64 a) {
  return sin(a);
}

static __inline__ fgFLOAT32 flgr_defop_tan_fgFLOAT32(fgFLOAT32 a) {
  return tanf(a);
}
static __inline__ fgFLOAT64 flgr_defop_tan_fgFLOAT64(fgFLOAT64 a) {
  return tan(a);
}

static __inline__ fgFLOAT32 flgr_defop_acos_fgFLOAT32(fgFLOAT32 a) {
  return acosf(a);
}
static __inline__ fgFLOAT64 flgr_defop_acos_fgFLOAT64(fgFLOAT64 a) {
  return acos(a);
}

static __inline__ fgFLOAT32 flgr_defop_asin_fgFLOAT32(fgFLOAT32 a) {
  return asinf(a);
}
static __inline__ fgFLOAT64 flgr_defop_asin_fgFLOAT64(fgFLOAT64 a) {
  return asin(a);
}

static __inline__ fgFLOAT32 flgr_defop_atan_fgFLOAT32(fgFLOAT32 a) {
  return atanf(a);
}
static __inline__ fgFLOAT64 flgr_defop_atan_fgFLOAT64(fgFLOAT64 a) {
  return atan(a);
}


static __inline__ fgFLOAT32 flgr_defop_floor_fgFLOAT32(fgFLOAT32 a) {
  return floorf(a);
}
static __inline__ fgFLOAT64 flgr_defop_floor_fgFLOAT64(fgFLOAT64 a) {
  return floor(a);
}


static __inline__ fgFLOAT32 flgr_defop_ceil_fgFLOAT32(fgFLOAT32 a) {
  return ceilf(a);
}
static __inline__ fgFLOAT64 flgr_defop_ceil_fgFLOAT64(fgFLOAT64 a) {
  return ceil(a);
}


static __inline__ fgBIT flgr_defop_ne_fgBIT(fgBIT a, fgBIT b) {
  return (a!=b) ? MAX_fgBIT : 0;
}
static __inline__ fgUINT8 flgr_defop_ne_fgUINT8(fgUINT8 a, fgUINT8 b) {
  return (a!=b) ? MAX_fgUINT8 : 0;
}
static __inline__ fgUINT16 flgr_defop_ne_fgUINT16(fgUINT16 a, fgUINT16 b) {
  return (a!=b) ? MAX_fgUINT16 : 0;
}
static __inline__ fgUINT32 flgr_defop_ne_fgUINT32(fgUINT32 a, fgUINT32 b) {
  return (a!=b) ? MAX_fgUINT32 : 0;
}
static __inline__ fgUINT64 flgr_defop_ne_fgUINT64(fgUINT64 a, fgUINT64 b) {
  return (a!=b) ? MAX_fgUINT64 : 0;
}
static __inline__ fgINT8 flgr_defop_ne_fgINT8(fgINT8 a, fgINT8 b) {
  return (a!=b) ? MAX_fgINT8 : 0;
}
static __inline__ fgINT16 flgr_defop_ne_fgINT16(fgINT16 a, fgINT16 b) {
  return (a!=b) ? MAX_fgINT16 : 0;
}
static __inline__ fgINT32 flgr_defop_ne_fgINT32(fgINT32 a, fgINT32 b) {
  return (a!=b) ? MAX_fgINT32 : 0;
}
static __inline__ fgINT64 flgr_defop_ne_fgINT64(fgINT64 a, fgINT64 b) {
  return (a!=b) ? MAX_fgINT64 : 0;
}
static __inline__ fgFLOAT32 flgr_defop_ne_fgFLOAT32(fgFLOAT32 a, fgFLOAT32 b) {
  return (a!=b) ? MAX_fgFLOAT32 : 0;
}
static __inline__ fgFLOAT64 flgr_defop_ne_fgFLOAT64(fgFLOAT64 a, fgFLOAT64 b) {
  return (a!=b) ? MAX_fgFLOAT64 : 0;
}

static __inline__ fgBIT flgr_defop_eq_fgBIT(fgBIT a, fgBIT b) {
  return (a==b) ? MAX_fgBIT : 0;
}
static __inline__ fgUINT8 flgr_defop_eq_fgUINT8(fgUINT8 a, fgUINT8 b) {
  return (a==b) ? MAX_fgUINT8 : 0;
}
static __inline__ fgUINT16 flgr_defop_eq_fgUINT16(fgUINT16 a, fgUINT16 b) {
  return (a==b) ? MAX_fgUINT16 : 0;
}
static __inline__ fgUINT32 flgr_defop_eq_fgUINT32(fgUINT32 a, fgUINT32 b) {
  return (a==b) ? MAX_fgUINT32 : 0;
}
static __inline__ fgUINT64 flgr_defop_eq_fgUINT64(fgUINT64 a, fgUINT64 b) {
  return (a==b) ? MAX_fgUINT64 : 0;
}
static __inline__ fgINT8 flgr_defop_eq_fgINT8(fgINT8 a, fgINT8 b) {
  return (a==b) ? MAX_fgINT8 : 0;
}
static __inline__ fgINT16 flgr_defop_eq_fgINT16(fgINT16 a, fgINT16 b) {
  return (a==b) ? MAX_fgINT16 : 0;
}
static __inline__ fgINT32 flgr_defop_eq_fgINT32(fgINT32 a, fgINT32 b) {
  return (a==b) ? MAX_fgINT32 : 0;
}
static __inline__ fgINT64 flgr_defop_eq_fgINT64(fgINT64 a, fgINT64 b) {
  return (a==b) ? MAX_fgINT64 : 0;
}
static __inline__ fgFLOAT32 flgr_defop_eq_fgFLOAT32(fgFLOAT32 a, fgFLOAT32 b) {
  return (a==b) ? MAX_fgFLOAT32 : 0;
}
static __inline__ fgFLOAT64 flgr_defop_eq_fgFLOAT64(fgFLOAT64 a, fgFLOAT64 b) {
  return (a==b) ? MAX_fgFLOAT64 : 0;
}

static __inline__ fgBIT flgr_defop_gt_fgBIT(fgBIT a, fgBIT b) {
  return (a>b) ? MAX_fgBIT : 0;
}
static __inline__ fgUINT8 flgr_defop_gt_fgUINT8(fgUINT8 a, fgUINT8 b) {
  return (a>b) ? MAX_fgUINT8 : 0;
}
static __inline__ fgUINT16 flgr_defop_gt_fgUINT16(fgUINT16 a, fgUINT16 b) {
  return (a>b) ? MAX_fgUINT16 : 0;
}
static __inline__ fgUINT32 flgr_defop_gt_fgUINT32(fgUINT32 a, fgUINT32 b) {
  return (a>b) ? MAX_fgUINT32 : 0;
}
static __inline__ fgUINT64 flgr_defop_gt_fgUINT64(fgUINT64 a, fgUINT64 b) {
  return (a>b) ? MAX_fgUINT64 : 0;
}
static __inline__ fgINT8 flgr_defop_gt_fgINT8(fgINT8 a, fgINT8 b) {
  return (a>b) ? MAX_fgINT8 : 0;
}
static __inline__ fgINT16 flgr_defop_gt_fgINT16(fgINT16 a, fgINT16 b) {
  return (a>b) ? MAX_fgINT16 : 0;
}
static __inline__ fgINT32 flgr_defop_gt_fgINT32(fgINT32 a, fgINT32 b) {
  return (a>b) ? MAX_fgINT32 : 0;
}
static __inline__ fgINT64 flgr_defop_gt_fgINT64(fgINT64 a, fgINT64 b) {
  return (a>b) ? MAX_fgINT64 : 0;
}
static __inline__ fgFLOAT32 flgr_defop_gt_fgFLOAT32(fgFLOAT32 a, fgFLOAT32 b) {
  return (a>b) ? MAX_fgFLOAT32 : 0;
}
static __inline__ fgFLOAT64 flgr_defop_gt_fgFLOAT64(fgFLOAT64 a, fgFLOAT64 b) {
  return (a>b) ? MAX_fgFLOAT64 : 0;
}

static __inline__ fgBIT flgr_defop_lt_fgBIT(fgBIT a, fgBIT b) {
  return (a<b) ? MAX_fgBIT : 0;
}
static __inline__ fgUINT8 flgr_defop_lt_fgUINT8(fgUINT8 a, fgUINT8 b) {
  return (a<b) ? MAX_fgUINT8 : 0;
}
static __inline__ fgUINT16 flgr_defop_lt_fgUINT16(fgUINT16 a, fgUINT16 b) {
  return (a<b) ? MAX_fgUINT16 : 0;
}
static __inline__ fgUINT32 flgr_defop_lt_fgUINT32(fgUINT32 a, fgUINT32 b) {
  return (a<b) ? MAX_fgUINT32 : 0;
}
static __inline__ fgUINT64 flgr_defop_lt_fgUINT64(fgUINT64 a, fgUINT64 b) {
  return (a<b) ? MAX_fgUINT64 : 0;
}
static __inline__ fgINT8 flgr_defop_lt_fgINT8(fgINT8 a, fgINT8 b) {
  return (a<b) ? MAX_fgINT8 : 0;
}
static __inline__ fgINT16 flgr_defop_lt_fgINT16(fgINT16 a, fgINT16 b) {
  return (a<b) ? MAX_fgINT16 : 0;
}
static __inline__ fgINT32 flgr_defop_lt_fgINT32(fgINT32 a, fgINT32 b) {
  return (a<b) ? MAX_fgINT32 : 0;
}
static __inline__ fgINT64 flgr_defop_lt_fgINT64(fgINT64 a, fgINT64 b) {
  return (a<b) ? MAX_fgINT64 : 0;
}
static __inline__ fgFLOAT32 flgr_defop_lt_fgFLOAT32(fgFLOAT32 a, fgFLOAT32 b) {
  return (a<b) ? MAX_fgFLOAT32 : 0;
}
static __inline__ fgFLOAT64 flgr_defop_lt_fgFLOAT64(fgFLOAT64 a, fgFLOAT64 b) {
  return (a<b) ? MAX_fgFLOAT64 : 0;
}

static __inline__ fgBIT flgr_defop_le_fgBIT(fgBIT a, fgBIT b) {
  return (a<=b) ? MAX_fgBIT : 0;
}
static __inline__ fgUINT8 flgr_defop_le_fgUINT8(fgUINT8 a, fgUINT8 b) {
  return (a<=b) ? MAX_fgUINT8 : 0;
}
static __inline__ fgUINT16 flgr_defop_le_fgUINT16(fgUINT16 a, fgUINT16 b) {
  return (a<=b) ? MAX_fgUINT16 : 0;
}
static __inline__ fgUINT32 flgr_defop_le_fgUINT32(fgUINT32 a, fgUINT32 b) {
  return (a<=b) ? MAX_fgUINT32 : 0;
}
static __inline__ fgUINT64 flgr_defop_le_fgUINT64(fgUINT64 a, fgUINT64 b) {
  return (a<=b) ? MAX_fgUINT64 : 0;
}
static __inline__ fgINT8 flgr_defop_le_fgINT8(fgINT8 a, fgINT8 b) {
  return (a<=b) ? MAX_fgINT8 : 0;
}
static __inline__ fgINT16 flgr_defop_le_fgINT16(fgINT16 a, fgINT16 b) {
  return (a<=b) ? MAX_fgINT16 : 0;
}
static __inline__ fgINT32 flgr_defop_le_fgINT32(fgINT32 a, fgINT32 b) {
  return (a<=b) ? MAX_fgINT32 : 0;
}
static __inline__ fgINT64 flgr_defop_le_fgINT64(fgINT64 a, fgINT64 b) {
  return (a<=b) ? MAX_fgINT64 : 0;
}
static __inline__ fgFLOAT32 flgr_defop_le_fgFLOAT32(fgFLOAT32 a, fgFLOAT32 b) {
  return (a<=b) ? MAX_fgFLOAT32 : 0;
}
static __inline__ fgFLOAT64 flgr_defop_le_fgFLOAT64(fgFLOAT64 a, fgFLOAT64 b) {
  return (a<=b) ? MAX_fgFLOAT64 : 0;
}

static __inline__ fgBIT flgr_defop_ge_fgBIT(fgBIT a, fgBIT b) {
  return (a>=b) ? MAX_fgBIT : 0;
}
static __inline__ fgUINT8 flgr_defop_ge_fgUINT8(fgUINT8 a, fgUINT8 b) {
  return (a>=b) ? MAX_fgUINT8 : 0;
}
static __inline__ fgUINT16 flgr_defop_ge_fgUINT16(fgUINT16 a, fgUINT16 b) {
  return (a>=b) ? MAX_fgUINT16 : 0;
}
static __inline__ fgUINT32 flgr_defop_ge_fgUINT32(fgUINT32 a, fgUINT32 b) {
  return (a>=b) ? MAX_fgUINT32 : 0;
}
static __inline__ fgUINT64 flgr_defop_ge_fgUINT64(fgUINT64 a, fgUINT64 b) {
  return (a>=b) ? MAX_fgUINT64 : 0;
}
static __inline__ fgINT8 flgr_defop_ge_fgINT8(fgINT8 a, fgINT8 b) {
  return (a>=b) ? MAX_fgINT8 : 0;
}
static __inline__ fgINT16 flgr_defop_ge_fgINT16(fgINT16 a, fgINT16 b) {
  return (a>=b) ? MAX_fgINT16 : 0;
}
static __inline__ fgINT32 flgr_defop_ge_fgINT32(fgINT32 a, fgINT32 b) {
  return (a>=b) ? MAX_fgINT32 : 0;
}
static __inline__ fgINT64 flgr_defop_ge_fgINT64(fgINT64 a, fgINT64 b) {
  return (a>=b) ? MAX_fgINT64 : 0;
}
static __inline__ fgFLOAT32 flgr_defop_ge_fgFLOAT32(fgFLOAT32 a, fgFLOAT32 b) {
  return (a>=b) ? MAX_fgFLOAT32 : 0;
}
static __inline__ fgFLOAT64 flgr_defop_ge_fgFLOAT64(fgFLOAT64 a, fgFLOAT64 b) {
  return (a>=b) ? MAX_fgFLOAT64 : 0;
}


static __inline__ fgBIT flgr_defop_cmove_fgBIT(fgBIT a, fgBIT b, fgBIT c) {
  return ((a!=0) ? b : c);  
}
static __inline__ fgUINT8 flgr_defop_cmove_fgUINT8(fgUINT8 a, fgUINT8 b, fgUINT8 c) {
  return ((a!=0) ? b : c);  
}
static __inline__ fgUINT16 flgr_defop_cmove_fgUINT16(fgUINT16 a, fgUINT16 b, fgUINT16 c) {
  return ((a!=0) ? b : c);  
}
static __inline__ fgUINT32 flgr_defop_cmove_fgUINT32(fgUINT32 a, fgUINT32 b, fgUINT32 c) {
  return ((a!=0) ? b : c);  
}
static __inline__ fgUINT64 flgr_defop_cmove_fgUINT64(fgUINT64 a, fgUINT64 b, fgUINT64 c) {
  return ((a!=0) ? b : c);  
}
static __inline__ fgINT8 flgr_defop_cmove_fgINT8(fgINT8 a, fgINT8 b, fgINT8 c) {
  return ((a!=0) ? b : c);  
}
static __inline__ fgINT16 flgr_defop_cmove_fgINT16(fgINT16 a, fgINT16 b, fgINT16 c) {
  return ((a!=0) ? b : c);  
}
static __inline__ fgINT32 flgr_defop_cmove_fgINT32(fgINT32 a, fgINT32 b, fgINT32 c) {
  return ((a!=0) ? b : c);  
}
static __inline__ fgINT64 flgr_defop_cmove_fgINT64(fgINT64 a, fgINT64 b, fgINT64 c) {
  return ((a!=0) ? b : c);  
}
static __inline__ fgFLOAT32 flgr_defop_cmove_fgFLOAT32(fgFLOAT32 a, fgFLOAT32 b, fgFLOAT32 c) {
  return ((a!=0) ? b : c);  
}
static __inline__ fgFLOAT64 flgr_defop_cmove_fgFLOAT64(fgFLOAT64 a, fgFLOAT64 b, fgFLOAT64 c) {
  return ((a!=0) ? b : c);  
}






#endif

#ifdef __cplusplus
}
#endif
